import React, { useState, useEffect } from 'react';
import StudentList from '../StudentList';
import { getStudents } from '../../services/student'

export default function StudentContainer() {

    const [students, setStudents] = useState([])

    useEffect(() => {
        (async function () {
           const result = await getStudents(1, 10)
            console.log(result)
            setStudents(result.findByPage)
        })();
    }, [])

    return (
        <div>
            <StudentList stuList={students} />
        </div>
    )
}
